import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/index'

import javaConnector from "@/plugins/javaConnector";

Vue.config.productionTip = false

import directives from "@/plugins/directives";

Vue.use(directives)

import elementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(elementUI)

import Vmodal from "@/components/Vmodal";

Vue.component("vmodal", Vmodal)

import ContextMenu from "@/components/ContextMenu";

Vue.component("ContextMenu", ContextMenu)

import eventBus from "@/plugins/eventBus";
import fa from "element-ui/src/locale/lang/fa";

Vue.use(eventBus)

Vue.mixin({
  methods: {
    window_control(type, isMaxWindow) {
      if (type === "close") {
        javaConnector.exitProgram()
      } else if (type === 'min') {
        javaConnector.minimixed()
      } else if (type === 'max') {
        if (isMaxWindow) {
          javaConnector.unmaximixed()
        } else {
          javaConnector.maximixed()
        }
        store.commit("SET_WINDOWSTATUS", !isMaxWindow)
      }
    },
    loadStatus(param) {
      store.commit("SET_LOADINGCASE", param)
    }
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
